<%-- 
/*
Assignment 1
Class ID        : SE0691
Group           : 1
Due Date        : 20 November 2012
I declare that this assignment is my own work
in accordance with FPT Policy.
*/
--%>

<%@page import="edu.fpt.hib.News"%>
<%@page import="edu.fpt.dal.NewsDAL"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Detail News</title>
        <style type="text/css"> <!--@import url("../style.css");--></style>
        <script>function goBack()  {  window.history.back()  }</script>
    </head>
    <body>
        <%@include file="template/header.jsp" %>

        <div id="page">

            <%try {
                    int id = Integer.parseInt(request.getParameter("newsid"));
                    if (NewsDAL.getNews(id) == null) {
            %>
            News not found!
            <input class="searchsubmit" type='button' value='Back' onclick='goBack()'>
            <% } else {
                News news = NewsDAL.getNews(id);
            %>
            <h2 class="title">Reading : <%=news.getNewsTitle()%></h2>
            <strong>Title:</strong><br>
            <p><%=news.getNewsTitle()%></p><br>
            <strong>Content:</strong><br>
            <p><%=news.getNewsContent()%></p><br>
            <strong>Created Date:</strong><br>
            <%=news.getNewsDate()%>
            <%}%><br>
            <input class="searchsubmit" type='button' value='Back' onclick='goBack()'>
            <%
            } catch (Exception e) {
                out.println("Error: " + e.getMessage());%>
            <br><input class="searchsubmit" type='button' value='Back' onclick='goBack()'>
            <%}
            %>
        </div>
        <%@include file="template/footer.jsp" %>
    </body>
</html>
